DEBUG=1
PROFILE=0

CC=g++
CFLAGS= -Wall `wx-config --cppflags`
LDFLAGS= `wx-config --libs --gl-libs` -lGLEW -lGLU

ifeq ($(DEBUG),1)
	CFLAGS += -g -DDEBUG 
else
	CFLAGS += -O4 
	LDFLAGS += -s 
endif

ifeq ($(PROFILE),1)
	CFLAGS  += -pg 
	LDFLAGS += -pg 
endif

# hier ggf. weitere .cpp Dateien angeben:
SOURCES=gdvvk.cpp GDVFrame.cpp Canvas.cpp CanvasGL.cpp MyCanvas.cpp MyCanvasGL.cpp Vector3d.cpp

OBJS = $(patsubst %.cpp,build/%.o,$(SOURCES))

TARGET=gdvvk

.PHONY: all clean $(TARGET)

all: gdvvk
# @echo "Please use target: make mytest | make gdvvk"


gdvvk: $(OBJS) 
	$(CC) $^ $(LDFLAGS) -o gdvvk

mytest: build/Vector3d.o build/mytest.o
	$(CC) -g build/Vector3d.o build/mytest.o -o mytest

#----------------------------------------------------

build/%.o: %.cpp
	$(CC) $(CFLAGS) $< -c -o $@

clean:
	-rm -f build/*
	-rm -f mytest
	-rm -f gdvvk

# automatic dependencies
build/%.d: %.cpp
	@echo "Updating dependency file for $<"
	@set -e; $(CC) -MM $(CFLAGS) $< \
		| sed 's;\($*\)\.o[ :]*;build\/\1.o $@ : ;g' > $@; \
		[ -s $@ ] || rm -f $@

ifneq ($(MAKECMDGOALS),clean)
-include $(patsubst %.cpp,build/%.d,$(SOURCES))
endif
